/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package smsserver.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Administrator
 */
public class Tools {
    public static int getNetId(String iccid)
    {
        int netid = 0;//移动
        if(iccid.startsWith("898600"))
        {
            netid = 0;
        }else if(iccid.startsWith("898601"))
        {
            netid = 1;//联通
        }else{
            netid = 2;//电信
        }
        return netid;
    }
    
    public static String getDate()
    {
        Date utildate=new java.util.Date();
        DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");  
        return format1.format(utildate);
    }

    public static boolean isMobileNO(String mobiles){
          Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
          Matcher m = p.matcher(mobiles);
          return m.matches();  
    }
}
